import * as echarts from 'echarts';

export function echarts1() {
  return {
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'shadow'
      }
    },
    legend: {
      right:40,
      itemWidth: 10,
      itemHeight: 10,
      itemGap: 10,
      textStyle: {
        color: '#fff'
      }
    },
    grid: {
      top: 30,
      left: 15,
      right: 40,
      bottom: 10,
      containLabel: true
    },
    xAxis: [
      {
        type: 'category',
        data: [2019,2020,2021,2022],
        axisLabel: {
          interval: 0,
          textStyle: {
            color: '#D0DEEE'
          },
          // 默认x轴字体大小
          fontSize: 12,
          // margin:文字到x轴的距离
          margin: 15
        },
        axisLine: {
          show: true,
          lineStyle: {
            color: '#6C8097'
          }
        },
      }
    ],
    yAxis: [
      {
        name: '种植亩数',
        type: 'value',
        axisLine: {
          lineStyle: {
            color: '#DCE2E8'
          }
        },
        axisLabel: {
          interval: 0,
          textStyle: {
            color: '#D0DEEE'
          },
          // 默认x轴字体大小
          fontSize: 12,
          // margin:文字到x轴的距离
          margin: 15
        },
        splitLine: {
          show: true,
          lineStyle: {
            type: 'dashed',
            color: 'rgba(108, 128, 151, 1)'
          }
        },
      }
    ],
    series: [
      {
        name: '小麦',
        showBackground: true,
        type: 'bar',
        emphasis: {
          focus: 'series'
        },
        barWidth: 10,
        itemStyle: {
          barBorderRadius: 11,
        },
        data: [320, 332, 301, 334],
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
          { offset: 0, color: '#B59E1C' },
          { offset: .7, color: '#E3DC8A' },
          { offset: 1, color: 'rgba(0,0,0,0)' },
        ])
      }
    ]
  }
}
export function echarts2() {
  return {
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'shadow'
      }
    },
    grid: {
      top: 30,
      left: 15,
      right: 40,
      bottom: 10,
      containLabel: true
    },
    xAxis: [
      {
        name: '万斤',
        type: 'value',
        axisLine: {
          lineStyle: {
            color: '#DCE2E8'
          }
        },
        axisLabel: {
          interval: 0,
          textStyle: {
            color: '#D0DEEE'
          },
          // 默认x轴字体大小
          fontSize: 12,
          // margin:文字到x轴的距离
          margin: 15
        },
        splitLine: {
          show: true,
          lineStyle: {
            type: 'dashed',
            color: 'rgba(108, 128, 151, 1)'
          }
        },
      }
    ],
    yAxis: [
      {
        name: '年份',
        type: 'category',
        data: [2019,2020,2021,2022],
        axisLabel: {
          interval: 0,
          textStyle: {
            color: '#D0DEEE'
          },
          // 默认x轴字体大小
          fontSize: 12,
          // margin:文字到x轴的距离
          margin: 15
        },
        axisLine: {
          show: true,
          lineStyle: {
            color: '#fff'
          },
        },
      }
    ],
    series: [
      {
        name: '小麦',
        showBackground: true,
        type: 'bar',
        emphasis: {
          focus: 'series'
        },
        barWidth: 15,
        data: [18, 22, 24, 32],
        color: new echarts.graphic.LinearGradient(1, 0, 0, 1, [
          { offset: 0, color: '#EBCC22' },
          { offset: 1, color: '#EBCC22' }
        ])
      }
    ]
  }
}

export function echarts4() {
  return {
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'cross',
        label: {
          backgroundColor: '#6a7985'
        }
      }
    },
    grid: {
      left: 20,
      right: 20,
      bottom: 10,
      top: 30,
      containLabel: true
    },
    legend: {
      itemWidth: 10,
      itemHeight: 10,
      itemGap: 10,
      textStyle: {
        color: '#fff'
      }
    },
    xAxis: [
      {
        type: 'category',
        boundaryGap: true,
        data: ['2019', '2020', '2021', '2022'],
        axisLabel: {
          interval: 0,
          textStyle: {
            color: '#D0DEEE'
          },
          // 默认x轴字体大小
          fontSize: 12,
          // margin:文字到x轴的距离
          margin: 15
        },
        axisLine: {
          show: true,
          lineStyle: {
            color: '#6C8097'
          }
        },
      }
    ],
    yAxis: [
      {
        name: '节水量(吨)',
        type: 'value',
        axisLine: {
          lineStyle: {
            color: '#DCE2E8'
          }
        },
        axisLabel: {
          interval: 0,
          textStyle: {
            color: '#D0DEEE'
          },
          // 默认x轴字体大小
          fontSize: 12,
          // margin:文字到x轴的距离
          margin: 15
        },
        splitLine: {
          show: true,
          lineStyle: {
            type: 'dashed',
            color: 'rgba(108, 128, 151, 1)'
          }
        },
      }
    ],
    series: [
      {
        name: '次数',
        type: 'bar',
        areaStyle: {},
        emphasis: {
          focus: 'series'
        },
        data: [200, 172, 121, 104],
        lineStyle:{
          color: '#23B6FA'
        },
        barWidth: 10,
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
          { offset: 0, color: 'rgba(0, 89, 84, .3)' },
          { offset: 1, color: '#23B6FA' }
        ])
      },
      {
        name: '节水量基准线',
        type: 'line',
        emphasis: {
          focus: 'series'
        },
        smooth: true,
        data: [100, 112, 81, 114],
        lineStyle:{
          color: '#26A3F0',
          type: 'dashed'
        },
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
          { offset: 0, color: '#26A3F0' },
          { offset: 1, color: 'rgba(179, 101, 64, 0)' }
        ])
      },
      
      {
        name: 'xx',
        type: 'line',
        areaStyle: {},
        emphasis: {
          focus: 'series'
        },
        smooth: true,
        data: [120, 132, 101, 134],
        lineStyle:{
          color: '#20C3F5'
        },
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
          { offset: 0, color: '#20C3F5' },
          { offset: 1, color: 'rgba(179, 101, 64, 0)' }
        ])
      },
    ]
  }
}
export function echarts5() {
  return {
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'cross',
        label: {
          backgroundColor: '#6a7985'
        }
      }
    },
    grid: {
      left: 20,
      right: 20,
      bottom: 10,
      top: 30,
      containLabel: true
    },
    legend: {
      itemWidth: 10,
      itemHeight: 10,
      itemGap: 10,
      textStyle: {
        color: '#fff'
      }
    },
    xAxis: [
      {
        type: 'category',
        boundaryGap: true,
        data: ['2019', '2020', '2021', '2022'],
        axisLabel: {
          interval: 0,
          textStyle: {
            color: '#D0DEEE'
          },
          // 默认x轴字体大小
          fontSize: 12,
          // margin:文字到x轴的距离
          margin: 15
        },
        axisLine: {
          show: true,
          lineStyle: {
            color: '#6C8097'
          }
        },
      }
    ],
    yAxis: [
      {
        name: '用量(吨)',
        type: 'value',
        axisLine: {
          lineStyle: {
            color: '#DCE2E8'
          }
        },
        axisLabel: {
          interval: 0,
          textStyle: {
            color: '#D0DEEE'
          },
          // 默认x轴字体大小
          fontSize: 12,
          // margin:文字到x轴的距离
          margin: 15
        },
        splitLine: {
          show: true,
          lineStyle: {
            type: 'dashed',
            color: 'rgba(108, 128, 151, 1)'
          }
        },
      }
    ],
    series: [
      {
        name: '化肥',
        type: 'bar',
        smooth: true,
        areaStyle: {},
        emphasis: {
          focus: 'series'
        },
        data: [120, 132, 101, 134, 90, 230, 210],
        lineStyle:{
          color: '#2bbde7'
        },
        barWidth: 15,
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
          { offset: 0, color: '#2bbde7' },
          { offset: 1, color: '#2bbde7' }
        ])
      },
      {
        name: '农药',
        type: 'bar',
        smooth: true,
        areaStyle: {},
        emphasis: {
          focus: 'series'
        },
        data: [82, 293, 51, 184, 290, 130, 120],
        lineStyle:{
          color: '#2ce8cf'
        },
        barWidth: 15,
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
          { offset: 0, color: '#2ce8cf' },
          { offset: 1, color: '#2ce8cf' }
        ])
      },
      {
        name: '投入品基准线',
        type: 'line',
        smooth: true,
        areaStyle: {},
        emphasis: {
          focus: 'series'
        },
        data: [72, 113, 151, 124, 150, 120, 110],
        lineStyle:{
          color: '#26A3F0',
          type: 'dashed'
        },
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
          { offset: 0, color: '#26A3F0' },
          { offset: 1, color: 'rgba(0, 89, 84, 0)' }
        ])
      }
    ]
  };
}